<%--
 *  File:    ZylUploadTempDoctorPlan.jsp	
 *  @Author: jackwang 
 *  Date:    2013/01/10
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>
<%@ page import="com.oval.emanager.service.*" %>
<%@ page import="com.oval.foundation.DefaultParams"%>

<%
  //init param
  String privilegeCode = "ALL";
  String strTableName = "";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
  ExcelEngine.loadStaticFormatCache(DefaultParams.findParam("exceldesc-path"));
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>

<html>
<head>
<title>ZylUploadTempDoctorPlan</title>
<PageFlow:CheckPageFlow pageName="p_uploadtempdocplan" />
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>
<%
  Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  if(totalsummary == null) totalsummary = new Vector();
  

  String allflag = (String)pageContext.getAttribute("allflag");
  HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
  if(UserInfo == null) UserInfo = new HashMap();
  
  
  Integer year = (Integer)pageContext.getAttribute("year");
  
%>
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<style>
body
{
  width：100%;
  higth:100%;
  min-width:980px;
_ width:expression((document.documentElement.clientWidth||document.body.clientWidth)<1350?"1350px":"");
} 
* {
 margin: 0px;
 padding: 0px;
}
</style>
<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "ZylUploadTempDoctorPlan.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_check()
{    

    cform.actionname.value = "check";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_confirm(){
	cform.actionname.value = "confirm";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_refuse(){
    if(nullChecked(document.cform.uploadorgids))
        {
          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
          return;
        }
	cform.actionname.value = "refuse";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_agree(){
    if(nullChecked(document.cform.uploadorgids))
        {

          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
          return;
        }
	cform.actionname.value = "agree";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_approval(){

    if(nullChecked(document.cform.uploadorgids))
        {
          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
          return;
        }
	cform.actionname.value = "approval";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_giveup(){
	var flag1 = confirm("<%= message.getMessageDesc("SURE_GIVE_UP")%>");
	if(!flag1){
		return;
	}
	cform.actionname.value = "giveup";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}	

function page_operate(operand)
{

		    var file = cform.file.value;
			if(file == null)return;
		    cform.encoding="multipart/form-data";
		    cform.code.value = file.substring(file.lastIndexOf("\\")+1,file.indexOf("_"));
		    cform.csvfile.value = file.substring(0,file.lastIndexOf("."))+".csv";
		    cform.actionname.value = "loadfile";
		    cform.target = "_self";
		   	cform.submit();
	  
}



function page_print(){
     var url1 = "<%=reportURL%>/servlet/ExcecuteReport/temp_doctorplanerrormessage.sox?__format=xlsx&__folder=/ovalreport&e1="+document.cform.userid.value;
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);	

}

function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var uploadorgids = document.getElementsByName('uploadorgids');
	var length = uploadorgids.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
		if(!uploadorgids[i].disabled)
			uploadorgids[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			uploadorgids[i].checked = false;
		}	
	}
}

function page_confirm1(){
	 /*   if(nullChecked(document.cform.uploadorgids))
	        {
	          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
	          return;
	        }*/
		cform.actionname.value = "confirm1";
	    cform.target = "_self";
	    isRunning = true;
	    cform.submit();
	}
function page_uploadModify(){
	url= "<%=reportURL%>"+"/servlet/ExcecuteReport/temporgcollateerror.sox?__folder=/ovalreport&<%= OvalTools.randomURL() %>&employeeid=<%=UserInfo.get("userid")%>"; 
	var style = "height=600, width=900, top=50, left=120, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no";
	window.open (url, 'newwindow', style);
}

function page_check()
{    

    cform.actionname.value = "check";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_back(){

	self.location.href ="DoctorPlanManage.jsp?<%= OvalTools.randomURL() %>";
}

function page_down(){
    var url1 = "<%=reportURL%>/servlet/ExcecuteReport/temp_docprogoalserrormessage.sox?__format=xlsx&__folder=/ovalreport&e1="+document.cform.userid.value;
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
   popwindow = window.open(url1, "n1window", strstatus);	

}


function page_submit(){
	cform.actionname.value = "submit";
	cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_confirm1(){
	cform.actionname.value = "confirm1";
	cform.target = "_self";
	isRunning = true;
	cform.submit();
}
</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher"><input
	type="hidden" name="pagename" value="p_uploadtempdocplan"> 
	<input type="hidden" name="actionname"> 
	
	<input type="hidden" name="code" />
  	<input type="hidden" name="codeinsheet" value = "Y"/>
  	<input type="hidden" name="csvfile" />
  	<input type="hidden" name="uploadiflag" value = "tempdocplan"/>
	
	<input type="hidden" name="flag" value="doctorplan">
	<custom:hidden scope="session" name="userinfo" property="userid"></custom:hidden> 
	
    <input type="hidden" name="subjectcode" value="822">
    
    <input type="hidden" name="year" value="<%=year %>"/>
	
	<%--  page location   --%>
<%@ include file="/inc/PageLocation.inc"%>

<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<%--  search criteria  --%>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<td><%= label.getLabelName("L_Path") %><%= label.getLabelName("L_Colon") %><input
					type="file" name="file" size="30"> &nbsp;&nbsp;&nbsp;&nbsp;<a
					onclick="page_operate('upload')"><custom:button type="1"
					label="L_Finish" imgsrc="finish.gif" border="0" style="width:60" /></a>

				</td>			
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<div style="overflow:auto;height:350;text-align:center;" id="scrollGDiv">
		<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="4200">
          <tr class="deepblue-left">
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Provicetdr")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Dept")%></td>
	          <td width="3%" class="title_center" rowspan="2"><%=label.getLabelName("L_RegionOffice")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_ManagerCode")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_ManagerName")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Employeecode")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_employeenameDelegate")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Doctorcode")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_DoctorName")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Terminal")%><%=label.getLabelName("L_Code")%></td>
	          <td width="4%" class="title_center" rowspan="2"><%=label.getLabelName("L_Terminal")%><%=label.getLabelName("L_Name")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_YesOrNoOpen")%></td>         
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_YesOrNoBale")%></td>
	          <td width="3%" class="title_center" rowspan="2"><%=label.getLabelName("L_Country")%><%=label.getLabelName("L_Grade")%></td>
	          <td width="3%" class="title_center" rowspan="2"><%=label.getLabelName("L_Grade")%></td>
	          <td width="3%" class="title_center" rowspan="2"><%=label.getLabelName("L_Yl_Level")%></td>
	          <td width="3%" class="title_center" rowspan="2"><%=label.getLabelName("L_StandardDept")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_FactDept")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Variety")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_DoctorRecipel")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_Doctor")%><%=label.getLabelName("L_Grade")%></td>
	          <td width="2%" class="title_center" rowspan="2"><%=label.getLabelName("L_CurrentlyStatus")%></td>
	          
	          
	          
	          <td class="title_center"   width="6%" colspan="3">1<%=label.getLabelName("L_Quarter") %></td>
	          <td class="title_center"   width="6%" colspan="3">2<%=label.getLabelName("L_Quarter") %></td>
	          <td class="title_center"   width="6%" colspan="3">3<%=label.getLabelName("L_Quarter") %></td>
	          <td class="title_center"   width="6%" colspan="3">4<%=label.getLabelName("L_Quarter") %></td>
	          
	          <td class="title_center"   width="5%" rowspan="2"><%=label.getLabelName("L_ErrorMsg") %></td>
	          
	          
	          
          </tr>
          
          <tr class="deepblue-left">
             <td class="title_center" width="2%"><%= label.getLabelName("L_ThreeTarget") %></td>
           	 <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
             <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>
             <td class="title_center" width="2%"><%= label.getLabelName("L_ThreeTarget") %></td>
           	 <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
             <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>
             <td class="title_center" width="2%"><%= label.getLabelName("L_ThreeTarget") %></td>
           	 <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
             <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>
             <td class="title_center" width="2%"><%= label.getLabelName("L_ThreeTarget") %></td>
           	 <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Grade")%></td>
             <td class="title_center" width="2%"><%= label.getLabelName("L_Target") %><%=label.getLabelName("L_Prescription")%></td>                                       
		  </tr>
          <%
             int j = 0;
             int s=1;
             String strClassType = new String();
             String strIsChecked = "";
             Integer defaultId = new Integer(-1);
             boolean bHasChecked = false;
            
          %>
          <logic:iterate id="doctors" collection="<%= totalsummary %>" indexId="seq">
          	<%
            HashMap doctorinfo = (HashMap)pageContext.getAttribute("doctors");
            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }
            if(doctorinfo.get("errormassage") != null){
        		strClassType = "need";
        		
        	}
           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              //defaultId = (Integer)pageConfig.get("opencriterionid");
              bHasChecked = true;
              
            }else{
           		strIsChecked = "";
            }
            // s= ((Integer)pageConfig.get("opencriterionid")).intValue();
            j++;
          %>
<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" class="<%=JspHelper.filterNull( strClassType )%>">
      <td><custom:write  name="doctors" property="area1name" />&nbsp;</td>
      <td><custom:write  name="doctors" property="deptname"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="area2name"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="parentusername"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="paretnemployeename"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="username" />&nbsp;</td>
      <td><custom:write  name="doctors" property="employeename"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="doctorcode"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="doctorname"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="orgcode" />&nbsp;</td>
      <td><custom:write  name="doctors" property="orgname"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="isdeveloped"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="isbale"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="organalysisattr1"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="organalysisattr2" />&nbsp;</td>
      <td><custom:write  name="doctors" property="organalysisattr3"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="stddeptname"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="hospitaldeptname"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="productgroupname" />&nbsp;</td>
      <td><custom:write  name="doctors" property="qty"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="doctorlevel"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="currentstate"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="type1"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="level1" />&nbsp;</td>
      <td><custom:write  name="doctors" property="qty1"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="type2"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="level2"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="qty2"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="type3"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="level3"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="qty3"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="type4"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="level4"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="qty4"/>&nbsp;</td>
      <td><custom:write  name="doctors" property="errormassage"/>&nbsp;</td>	      	            
</tr>
</logic:iterate>
          
			<tr>
				<td colspan="35" align="left"><%= label.getLabelName("L_TotalData") + label.getLabelName("L_Colon") %><custom:write
					property="count" name="count" nbsp="true" /></td>
			</tr>

			<%@ include file="/inc/SummaryActionUP_DH.inc" %>
		</table>
		</div>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
	      	    <%if (totalsummary.size() > 0){ 
	      				if(("N").equals(allflag)){
				%>
				   <a onclick="page_check();"><custom:button type="1" label="L_CheckContent" imgsrc="new.gif" border="0" style="width:60"/></a>
				<%}else if(("Y").equals(allflag)){ %> 
				   <a onclick="javascript:page_print();"><custom:button type="1" label="L_Execcd" imgsrc="new.gif" border="0" style="width:60"/></a>				           
				   <a onclick="javascript:page_confirm();"><custom:button type="1" label="L_Submit1" imgsrc="new.gif" border="0" style="width:60" /></a>
                   <a onclick="javascript:page_giveup();"><custom:button type="1" label="L_GiveUp" imgsrc="new.gif" border="0" style="width:60"/></a> 
                   <a onclick="javascript:page_submit();"><custom:button type="1" label="L_ApprovieSubmit" imgsrc="new.gif" border="0" style="width:60"/></a>
    	           <!-- 
    	           <a onclick="javascript:page_confirm1();"><custom:button type="1" label="L_ApprovieSubmit" imgsrc="new.gif" border="0" style="width:60"/></a>  				                
    	           -->
    	        <%}
	      		}%>  
    	        <a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>           
              </td>
          </table>
        </td>
      </tr>
    </table>
</form>
</body>
<script>
  document.getElementById("scrollGDiv").style.width=(screen.availWidth - 30);
</script>
</html>